package com.zixi.ai.workflow.controller;

import com.alibaba.fastjson2.JSONObject;
import com.zixi.ai.common.domain.R;
import com.zixi.ai.framework.controller.BaseTemplateController;
import com.zixi.ai.workflow.entity.AiWorkflowEntity;
import com.zixi.ai.workflow.service.IAiWorkflowService;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author wfg
 */
@RestController
@RequestMapping("/ai/workflow")
@RequiredArgsConstructor
@Tag(name = "工作流")
public class AiWorkflowController extends BaseTemplateController<IAiWorkflowService, AiWorkflowEntity, Long> {
    @PostMapping("tryRunning")
    public R<Map<String, Object>> tryRunning(@RequestParam(value = "id") Long id, @RequestBody JSONObject variables) {
        return R.ok(service.tryRunning(id, variables));
    }
}
